-
Notifications
You must be signed in to change notification settings - Fork 721
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
support leaky_relu half kernel #7569
Conversation
TODO:需要到刷榜的程度,再分开成两种求导方式,一种是alpha为正的时候,使用输出来求。一种是alpha为负的时候,使用输入来求 |
@olojuwin 朱望可以注意一下这个。leaky_relu可以通过特判alpha节省显存扩大分类数,后面如果有需要可以做一下这个优化。 |
Code got formatted by CI. Please request CI again if you still want to have this PR merged. If the PR is from a forked repo, please download the patch files from the GitHub Actions web page and apply them locally. |
Code got formatted by CI. Please request CI again if you still want to have this PR merged. If the PR is from a forked repo, please download the patch files from the GitHub Actions web page and apply them locally. |
Speed stats:
|
CI failed when running job: cpu-module. PR label automerge has been removed |
Code got formatted by CI. Please request CI again if you still want to have this PR merged. If the PR is from a forked repo, please download the patch files from the GitHub Actions web page and apply them locally. |
Speed stats:
|
OF_DEVICE_FUNC explicit LeakyReluGradFunctor(float alpha) : alpha(alpha) {} | ||
OF_DEVICE_FUNC T operator()(T x, T dy) const { | ||
if (alpha > 0) { | ||
return dy > 0 ? dy : dy * alpha; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
这里是要写 y > 0 ? dy : dy * alpha
么?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
是的,神奇,我为什么能通过单测。。。我修一下
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
应该是x>0 ? dy : dy * alpha
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
y和x大于0一样的,这里特判了一下alpha>0,这个特判没有必要我去掉一下。
* support leaky_relu half kernel * add half leaky relu * fix comment * add half leaky relu impl * fix comment * fix comment * revert * auto format by CI * fix error * auto format by CI Co-authored-by: oneflow-ci-bot <ci-bot@oneflow.org> Co-authored-by: oneflow-ci-bot <69100618+oneflow-ci-bot@users.noreply.github.com>
RT。